﻿#include <iostream>
using namespace std;

//class person
//{
//public:
//	void print()
//	{
//		cout << "_name " << _name << endl;
//		cout << "_age " << _age << endl;
//	}
//protected:
//	string _name = "zhangsan";
//	int _age = 18;
//};
//
//class student : public person
//{
//protected:
//	double _score;
//};
//
//class teacher : public person
//{
//protected:
//	int _class;
//};
//int main()
//{
//	person p1;
//	p1.print();
//	student p2;
//	p2.print();
//	return 0;
//}

//class person
//{
//public:
//	void print()
//	{
//		cout << "_name " << _name << endl;
//		cout << "_age " << _age << endl;
//	}
//
//	void change_name(const string& s)
//	{
//		_name = s;
//	}
//
//protected:
//	string _name = "zhangsan";
//	int _age = 18;
//};
//
//class student : public person
//{
//protected:
//	double _score;
//};
//
//class teacher : public person
//{
//protected:
//	int _class;
//};
//int main()
//{
//
//	student s1;
//	person& s2 = s1;
//	s1.print();
//	s2.print();
//	s2.change_name("Lisi");
//	s1.print();
//	s2.print();
//}

//class Student
//{
//protected:
//	int _num;//学号
//};
//
//class Teacher
//{
//protected:
//	int _id;//职工编号
//};
//
//class Assistant : public Student, public Teacher
//{
//protected:
//	string _majorCourse;//主修课程
//};
//
//int main()
//{
//	Assistant a1;
//	return 0;
//}

class A
{
public:
	virtual void func1()
	{
		cout << "A-func1" << endl;
	}
public:
	int _a;
};

class B : virtual public A
{
public:
	virtual void func1()
	{
		cout << "B-func1" << endl;
	}
	virtual void func2()
	{
		cout << "B-func2" << endl;
	}
public:
	int _b;
};

class C : virtual public A
{
public:
	virtual void func1()
	{
		cout << "C-func1" << endl;
	}
	virtual void func2()
	{
		cout << "C-func1" << endl;
	}
public:
	int _c;
};

class D : public B, public C
{
public:
	virtual void func1()
	{
		cout << "D-func1" << endl;
	}
public:
	int _d;
};

int main()
{
	D d;
	d.B::_a = 1;
	d.C::_a = 2;
	d._b = 3;
	d._c = 4;
	d._d = 5;
	return 0;
}